Adding Sounds to an Object
How to add sounds to an object Load the Object you wish to add sounds to. Using the Editor and highlighting a sound file from the tree will give you three folders containing items to "Tweak" in the Tweak bar. The Flags and Default folder trees don't matter much in BF2 as far as actually playing any sounds. No need to modify any content there. The one you need to spread out is the "Sound" tree. Top to bottom... ObjectTemplate.SoundFileName "location of sound file by address goes here" This can seem trickey if you have added a sound to your Mod and it doesn't show up for you. Once you click the three dots next to the code itll give you a plus sign an X sign and that is it. If there is a file there you dont want to use, highlight it and hit the red X sign. To add the new file you have added to your Mod, select the blue Plus sign. This is where it looks confusing. Your Mod will be selected but there is no sounds for you to use? They are there but the Editor has an issue with not displaying it... yet. On the top of the new window is a dropdown selection. Your Mods name will be selected already. It looks like its just a header but it is a dropdown selection list. Reselect your Mod from the list. Now you can see the sound file you have in your Mod. If it isnt there, you have to add it to your Mods files and then restart the Editor. Adding or changing files, once the Editor is running, does not add them to the Editor by default. Shut it down and restart it. Next is another complicated issue. ObjectTemplate.VolumeEnvelope ... ObjectTemplate.PitchEnvelope ... I asked myself "What the h3ll is a 'envelope'?" for quite a few days. It is a graph. (I slapped myself once I realized what the graph was for.) The same graph is used for Volume and Pitch in BF2. They each do seperate things to the sound you added, but the graph is the same function for each. Volume is easier to understand. Vertically, the graph displays Volume. (But, what the heck is the Horizontal?) Horizontally, the graph is for RPM. How fast whatever spins or moves. Almost nothing that moves in BF2 just hits top speed immediately. The graph is to alter the sound file based on a standstill versus top speed in-game. Not all sounds in BF2 require either of these "envelopes" to contain any data. This information is for when you want to include these effects with things that can use these settings to make the game more realistic. Engines are a good example. You want them to sound as if they spool up or 'whine' to life when you hit the throttle. The editor provides a decent in-game "mixer" so you can hear sounds of engines vs RPM just by sliding a RPM bar. More on that toward the end. As the RPM increases, the volume will ater in-game based on what the graph says the volume should be. In the pic I provided, the volume of THAT particular sound decreases as the RPM of the engine increases. (It is the Start-Idle-Stop Sound. Idle, in this case, isnt heard much at full speed.) (Once the RPM drops, the sound volume increases. It works both ways ) Pitch, in-game is a weird thing. The game will speed up the actuall sound file or slow it down. This alters how it sounds. Slowing the sound down will make it sound deeper in tone/bass and speeding it up will make it sound tinny. This is how a 'engine' in BF2 semms to whine higher as you go faster. The higher the graph 'point's the higher the pitch. Lower on the graph, is lower. ObjectTemplate.LoopCount X Loop is weird. Nothing better to call it. Straight forward, it is how many loops the sound will play. (NOT FOR ENGINE USE) ... (LOL) ObjectTemplate.MinDistance X The minimum distance for a sounds FULLest volume after considering... stuff.:-P All locations inside this radius will hear the sound at full voume as allowed. ObjectTemplate.HalfVolumeDistance XXX Once players are at this point in-game, the volume will be at half the max volume allowed. HalfVolumeDistance is used to control how far away players can be and still hear the sound. MinimumDistance + 2 * HalfVolumeDistance = total distance before Volume zero's. ''Note: Pay close attention to this as too much sound in any players game will cause lag via the sound card.'' ObjectTemplate.Pitch (0-5) Again, with the pitch? Zero to five, that is your range of choices. "1" is default, as the Sound was recorded. (Apparently the graph, evelope, dohickey-thing from above alters pitch from THIS setting.) Higher numbers will make the sound tinny and lower (fractions) will make the sound more bass. Experiment. ObjectTemplate.Reverb ??? Don't know bout this one since I am hard of hearing anyways. I do know "1" is the highest number the editor will allow. ObjectTemplate.SoundRadius ??? I think this setting is to help keep PCs clocks for more gameplay and less sound play. Meaning, I think this is used for static Objects in-game. Less calculations needed then. ObjectTemplate.Sample Schmample Dont know. Dont care. All BF2 sounds have same numbers the editor drops in by default. Moving on. ObjectTemplate.Is3dSound 1,0 Either on or off. Is it or not? Is it a first person fire sound? Or, is it a third person fire sound? It does make a difference. Remember, if it can aleviate a burdened sound card, use it. First person sounds should NOT be 3D, aka Stereo. (Who cares if I can hear my shot in the dark in 3D? I wanna hear his shot in 3D so I can find his @:-? .) ObjectTemplate.StopType 1,2 "1" or "2" are the only Options I know of. These are based on the markers created within the sound file itself. Get with the guy that made it to get it right in code and in the sound file. ObjectTemplate.Pan X "0" to "1" is the options. I have been told it is a left to right option for the sound file played in stereo. See what you can do with it. I can't think of any use the change it from center, 0.5. ObjectTemplate.InnerConeAngle XXX ObjectTemplate.OuterConeAngle XXX Umm...... Wow. This one took me longer than those graphs. I thumped my head into the wall several times before the brain cells aligned enough for me to see what they were. Kinda simple once you visualize it. It is yet another set of code to alter volume for a sound. Remember, that in the BF2 game engine, every piece of created 'whatever' can be moved around and rotated. This "whatever' can even include sounds. Move the sound around in the Editor by dragging its arrows once it has been selected. Hold the shift key and rotate it. "ROTATE IT !!!???" "Why?" Here is why... The Cone angles control volume in a sphere around the sound object. Now, I cant draw a sphere you can see on a web page but I did draw a set of circles for you. Have a buddy jump in a jet for you. Tell him to NOT take off or even touch the throttles. Run around the jet on the ground. Can you hear it? The differences? That is the cone angles. Still asking why to rotate it? Engines have from 3 to 5 sounds that can be added to them for the games sound effects. One is the start-idle-stop. That is what you were hearing on the ground around it. That is what you see represented in my pic provided. Why, if the jet was flying, would you hear many of the engine sounds if the jet is flying toward you? If it is supersonic, you shouldn't hear anything from it, until it passes you. BF2 doesn't do supersonic, but you get my point. Rotate the sound 'object' 180 degrees so the outer angle is facing forward. The difference is, everywhere inside the inner angle (which starts at the front of the sound 'object') is at full volume allowed. From that angle on, the volume can decrease. OuterAngle is where the volume decrease stops decreasing. Note: ''The outer and inner angles can overlap a full 360 degrees. As a matter of fact, default for all BF2 sounds is "360" for each angle code.'' ObjectTemplate.ConeOuterVolume X "0" to "1" is the Options. This is the volume between the OuterAngle (the rest of the sphere). Experiment with deicimals. ObjectTemplate.GlobalEffectLevel X ObjectTemplate.VolumeGroup. X I havn't the faintest what these are, or do. Maybe someone can come up with explanations for them. By the look of them, they may alter who hears them and when, or where. They may have something to do with Global Ambiance settings. Now for the "Mixer" I was talking about. Select the actual engine you have added sounds to from the "Resources" window on the far left. Then scroll down in the "Editor"/ "Object" window all the way on the far right. You will see a header called "Sound". Click it to display the tools available for sound. Click the "Show Engine View" button. There is the "mixer" I have been typing about. The 'mixer' doesn't do much in the way of allowing you to alter tweak code but, it does allow you to select either Pitch or volume for each sound and sliders to alter volumes and pitch for those sounds. The "mixer" will play through the sounds of an engine based on the RPM slider lights. Default for the "mixer" is RPM of -100. Slide the RPM lights untill it reaches zero. (Just click the bar and drag.) This is a fantastic method of hearing the interactions of sounds without having to go in-game. The only fault I have with the Editor concerning all these sound settings is that you cant have the Editor play sounds while in "Free" Mode. There is no way to verify the Angles, other that rotating the objects and then restarting the Editor, without saving changes. Dumb. You HAVE to go in-game, with a freind, and listen to the ConeAngle's changes there. Have fun experimenting some expansion: Quote "1" or "2" are the only Options I know of. These are based on the markers created within the sound file itself. Get with the guy that made it to get it right in code and in the sound file. 0: play forever, if loopCount 0 1: loop entire sample 2: loop using regions embedded in file (WAV files only) Thanks, nice bit of info there, I may as well add to it. To get a better Idea of the sound setup goto render/toggle draw sound. Also good idea to turn on render/toggle draw min distance (area the sound will be heard) note: 1st person weapon sound files are usually ( I say usually because if there's one thing we can count on in BF2... it is consistency :roll:) in stereo. (e.g. ObjectTemplate ActiveSafe S_Big_ass_handweapon_fire1p) It gives a nice full weapon sound for the player. They don't have to be stereo but I like the nice stereo immersion. You are correct in that Is3dSound should be 0 (off) for 1p. 3p weapon sound files must be mono or else they are heard over the entire map and you have no clue where they are coming from. :wink: All engine sound files must be mono as well for the same reason. The sound file itself is mono, yes but my intent was to explain the code. The sound files for 3P and engines are near always 3DSound. The file is mono but the sound in-game plays for 3D environment. Apparently the mono and stereo you speak of needs to be addressed with more stress. If you use a stereo sound in a location that requires it to be mono, the sound WILL play over the entire map, to all players, at full volume as if it were first person. If it is a weapon, everyone will hear it as if they fired it.....loud If it is a Engine, everyone will hear it as if they were standing next to it, no matter how far they are actually away from it. Fix any sounds errors such as this by reverting the sound file itself to Mono and then check the code to see if you want the game to use 3D settings. The games engine will play the mono sound but the code just apears to be asking for a 3D sound. In actuallity, the code tells the game engine to play the sound in three dimentions as it moves. If a jet passes a player from left to right, the game code will tell it to play the sound from left to right in the speakers. That is all it means. I have noticed that Sound Forge is really needed for the Region loop points to be recognized. Wavelab doesnt create markers that are considered "Region" points. Also, about the Mono Stereo issue. First person Weapon sounds can be in Stereo, third person needs no stereo perspective, it would only screw up any realtime effects the engine would do. Engine sounds have lots of different perspectives that you can move around, so stereo isnt going to work there. I was trying to use the Right engine S_I_S slot, and hard pan it right. Then use the Left one and pan it hard left. That way I could split a great stereo file bounce into its seprerate channels, and fake the engines into playing back a stereo sound. Theoretically, this should work, but it can still be heard all across the map, even though its two seperate mono files. I would like to solve that one, and want to knwo why they never used the right engine slots. Ill post up any good results I find. {C}